<%@ page import="com.wd.entity.Blog" %>
<%@ page import="com.wd.entity.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="author" content="order by dede58.com"/>
    <title>my personal blog | 用戶編輯</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <link href="admin/dist/js/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="admin/dist/js/plugins/bootstrap/css/bootstrap-fileupload.css" rel="stylesheet"/>
    <link href="admin/dist/css/todcsw.css" rel="stylesheet"/>
    <%--  引入所有需要用到的css  --%>
    <jsp:include page="index/css.jsp"/>
    <style>
        .editormd-dialog-container select {
            display: initial;
        }
    </style>
</head>

<body class="hold-transition sidebar-mini">
<div class="wrapper">

    <!-- 引入页面头header.jsp -->
    <jsp:include page="index/header.jsp"/>

    <!-- 引入工具栏left.jsp -->
    <jsp:include page="index/left.jsp"/>

    <!-- Content Wrapper. Contains page content -->

    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <div class="content-header">
            <div class="container-fluid">
            </div><!-- /.container-fluid -->
        </div>
        <!-- Main content -->
        <form id="userForm" method="post" action="EditUserServlet" >
            <div class="content">
                <div class="container-fluid">
                    <div class="card card-primary card-outline">
                        <div class="card-body">
                            <!-- 几个基础的输入框，名称、分类等输入框 -->

                            <div class="form-group" style="display:flex;">

                                <input type="hidden" name="op" value="">
                                <input type="hidden" id="userId" name="userId" value="${sessionScope.user.id}">
                                <input type="hidden" name="account" value="${sessionScope.user.account}">
                                <input type="hidden" name="password" value="${sessionScope.user.password}">
                                <input type="hidden" name="problem" value="${sessionScope.user.problem}">
                                <input type="hidden" name="answer" value="${sessionScope.user.answer}">
                                <input type="hidden" name="createTime" value="${sessionScope.user.createTime}">
                                <input type="hidden" name="identify" value="${sessionScope.user.identify}">
                                <div class="form-control">用&nbsp;&nbsp;戶&nbsp;&nbsp;名:</div><input type="text" class ="form-control col-sm-5" placeholder="用户名" id="account2" name="account2" value="${sessionScope.user.account}">
                                <div class="form-control">密保问题:</div><input type="text" class="form-control col-sm-5" id="problem2" name="problem2" placeholder="密保问题" value="${sessionScope.user.problem}">
                            </div>
                            <div  class="form-group" style="display:flex;">
                                <div class="form-control">密保答案:</div><input type="text" class="form-control col-sm-5" id="answer2" name="answer2" placeholder="密保答案" value="${sessionScope.user.answer}">
                                <div class="form-control">个人签名:</div><input type="text" class="form-control col-sm-5" id="identify2" name="identify2" placeholder="个人签名" value="${sessionScope.user.identify}">
                            </div>
                            <div class="form-group">
                                <!-- 按钮 -->
                                &nbsp;<button id="saveButton" class="btn btn-info float-right"
                                              style="margin-left: 5px;" onclick="updateUser()">保存
                            </button>&nbsp;
                                &nbsp;<button class="btn btn-secondary float-right" style="margin-left: 5px;"
                                              id="cancelButton" onclick="forward()">返回
                            </button>&nbsp;
                            </div>

                        </div>

                    </div>
                </div><!-- /.container-fluid -->
            </div>
    </form>
    </div>
    <!-- /.content-wrapper -->
    <!-- 引入页脚footer.jsp -->
    <jsp:include page="index/footer.jsp"/>
</div>
<!-- jQuery -->
<script type="text/javascript" src="X-admin/js/jquery.min.js"></script>
<script type="text/javascript" src="X-admin/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="X-admin/js/xadmin.js" charset="utf-8"></script>
<script type="text/javascript" src="X-admin/js/formSelects-v4.min.js" charset="utf-8"></script>

<%--<!--[if lt IE 9]>--%>

<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>

<![endif]-->
<!-- jQuery -->
<script src="admin/plugins/jquery/jquery.min.js"></script>
<%--<!-- jQuery UI 1.11.4 -->--%>
<script src="admin/plugins/jQueryUI/jquery-ui.min.js"></script>
<%--<!-- Bootstrap 4 -->--%>
<script src="admin/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="admin/dist/js/adminlte.min.js"></script>
<!-- editor.md -->
<%--<script src="admin/plugins/editormd/editormd.min.js"></script>--%>
<!-- tagsinput -->
<script src="admin/plugins/tagsinput/jquery.tagsinput.min.js"></script>
<!-- Select2 -->
<script src="admin/plugins/select2/select2.full.min.js"></script>
<!-- sweetalert -->


<script src="admin/plugins/sweetalert/sweetalert.min.js"></script>
<!-- ajaxupload -->
<script src="admin/plugins/ajaxupload/ajaxupload.js"></script>

<script src="admin/dist/js/public.js"></script>

<!-- editor.md -->
<script type="text/javascript" src="X-admin/editormd/src/editormd.js"></script>
<%--弹框等js--%>
<script type="text/javascript" src="admin/dist/js/edit2.js"></script>

<%--文件上传--%>
<script type="text/javascript" src="admin/dist/js/plugins/bootstrap/js/bootstrap-fileupload.js"></script>
<script>



    function forward() {
        window.location.href = "UserServlet";
    }

    function updateUser() {
        $("input:hidden[name='op']").val("updUserById");
        // alert($("input:hidden[name='op']").val());
        $("#userForm").submit();
        // alert($("input:hidden[name='op']").val());
    }

    $(function () {

        $("#confirmButton").click(function () {
            $("#articleModal").modal("show");
        })


        // $("#saveButton").click(function () {
        //         $("input:hidden[name='op']").val("updUserById");
        //         // alert($("input:hidden[name='op']").val());
        //         $("#userForm").submit();
        //     alert($("input:hidden[name='op']").val());
        // });


        $(".userId").val($("input:hidden[name='userId']").val());


        $("#userCategoryId option").each(function () {  //遍历所有option
            var channlVal = $(this).val();   //获取option值
            if (channlVal == $("input:hidden[name='catalog']").val()) {
                $(this).prop("selected", true);
            }
        })



        $(".editormd-markdown-textarea").val($("input:hidden[name='userContentEdit']").val());
    })


</script>
<%
    request.getSession().setAttribute("user", new User());
%>
</body>
</html>
